package com.example.designpatterns.creational.builder.inner;

import lombok.Data;

/**
 * 课程类，假装是一个很复杂的类
 *
 * @author scott
 */
@Data
public class Course {

    private String name;
    private String ppt;
    private String video;
    private String note;
    private String homework;

    /**
     * 静态内部类建造者
     */
    public static class Builder {

        private final Course course = new Course();

        public Builder addName(String name) {
            course.setName(name);
            return this;
        }

        public Builder addPpt(String ppt) {
            course.setPpt(ppt);
            return this;
        }

        public Builder addVideo(String video) {
            course.setVideo(video);
            return this;
        }

        public Builder addNote(String note) {
            course.setNote(note);
            return this;
        }

        public Builder addHomework(String homework) {
            course.setHomework(homework);
            return this;
        }

        public Course build() {
            // 这一步可以做一些参数校验之类的操作
            return course;
        }

    }

}
